import React, { useEffect } from 'react'
import type { AppProps } from 'next/app'
import zh_CN from 'antd/lib/locale/zh_CN'

import './index.scss'
import { ConfigProvider } from 'antd'
import { useRouter } from 'next/router'
// import About from '@/components/about'
const env = process.env.RUNTIME_ENV


const MyApp: React.FC<AppProps> = ({ Component, pageProps }: AppProps) => {
    const router = useRouter();
    const { staging } = pageProps || {}

    // useEffect(() => {
    //     const token = sessionStorage.getItem("token");
    //     if (token) {
    //         router.push("/system")
    //     } else {
    //         router.push("/login")
    //     }
    // }, []);

    return (
        <ConfigProvider locale={zh_CN}>
            <Component {...pageProps} />
            {!!staging && <div style={{ position: "fixed", top: "10px", right: "10px", color: 'red' }}>{staging}</div>}
        </ConfigProvider>
    )
}

export default MyApp
